import { defineStore } from 'pinia'
import * as constant from '@/constants'

import type { IMainState, IMainActions } from '../type/mainType'

const useMainStore = defineStore<'main', IMainState, any, IMainActions>('main', {
  state: () => ({
    name: 'Hello World',
    count: 0,
  }),
  getters: {},
  actions: {
    [constant.CHANGE_NAME](name: string) {
      this.name = name
    },

    [constant.CHANGE_COUNT](count: number) {
      this.count += count
    },
  },
})

export default useMainStore
